package com.lifesting.workflow.runtime;

import java.util.Hashtable;

import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

import com.lifesting.workflow.runtime.service.WfsService;
import com.lifesting.workflow.runtime.service.impl.WfsServiceImpl;

public class Activator implements BundleActivator {

	private WfsService wfsService;
	private static Bundle bundle;
	
	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		bundle = context.getBundle();
		wfsService = new WfsServiceImpl();
		// register the service
		context.registerService(WfsService.class.getName(), wfsService, new Hashtable<String,Object>());
	}
	public static Bundle getBundle() {
		return bundle;
	}
	
	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
		bundle = null;
	}

}
